package com.spukmk3me.animatorpack.pack0;

import com.spukmk3me.math.Matrix4f;
import com.spukmk3me.scene.Animator;
import com.spukmk3me.scene.Node;
import com.spukmk3me.util.ContinuousTimedAnimation;
import com.spukmk3me.util.Util;

/**
 *  A animator that makes scene nodes move in a zigzag line.
 *  \details It's based on TranslateAnimator.
 */
public class MultiColorAnimator extends Animator
{
    public MultiColorAnimator()
    {
        m_animation = new ContinuousTimedAnimation();
    }
    
    public void setColors( int[] argbColors )
    {
        m_colors = argbColors;
    }
    
    public int[] getColors()
    {
        return m_colors;
    }
    
    @Override
    public boolean isAnimating()
    {
        if ( getNode() == null )
            return false;

        return m_animation.isAnimating();
    }
    
    @Override
    protected void onNodePrepareToChange( Node arg0 ) {}

    @Override
    protected void onNodeChanged() {}

    @Override
    protected void animate( int deltaTime )
    {
        m_animation.execute( deltaTime );
        
        

        if ( m_colorType == PLANECOLOR )
        {
            
        }
        else if ( m_colorType == ADDITIONALCOLOR )
        {
            
        }
    }
    
    public final void setAnimating( int[] times, int[] relayTimes, int mode,
        int movingTime, int numberOfMoves, boolean fixedStopPosition, byte colorType )
    {
        //m_animation.setAnimation( times, relayTimes, mode, movingTime, numberOfMoves, fixedStopPosition );
        m_colorType = colorType;
    }
    
    /*private int calculateColor( int color1, int color2, int color1Factor )
    {
        int color, c1, c2;
        
        c1      = (color1 >> 8) & 0x00FF0000;
        c2      = (color2 >> 8) & 0x00FF0000;
        color   = ((c1 * c2 / 255 + c1 + c2) & 0x00FF) << 24;
        color   = ((c1 * c2 / 255 + c1 + c2) & 0x00FF) << 24;
        
        c1      = (color1 >> 16) & 0x00FF;
        c2      = (color2 >> 16) & 0x00FF;
        color  |= ((c1 * c2 / 255 + c1 + c2) & 0x00FF) << 16;
        
        c1      = (color1 >> 8) & 0x00FF;
        c2      = (color2 >> 8) & 0x00FF;
        color  |= ((c1 * c2 / 255 + c1 + c2) & 0x00FF) << 8;
        
        c1      = color1 & 0x00FF;
        c2      = color2 & 0x00FF;
        color  |= (c1 * c2 / 255 + c1 + c2) & 0x00FF;
        
        return color;
    }*/
    
    public static final byte PLANECOLOR = 0;
    public static final byte ADDITIONALCOLOR = 1;
    
    private ContinuousTimedAnimation    m_animation;
    private int[]                       m_colors;
    private byte                        m_colorType;
}